export default function(app) {
  app.service('ngDialogTechTraining', ngDialogTechTraining);

  function ngDialogTechTraining(ngDialog) {
    'ngInject';

    this.confirm = (id) => {
      ngDialog.open({
        template: 'queryInfoDisclosure',
        className: 'ngdialog-theme-default pa-special-check-item-list-theme',
        controllerAs: 'vm',
        controller: function techTrainingCtrl($rootScope, $scope, $http) {
          'ngInject';

          // 文件下载
          this.getDownloadSrc = (file) => {
            return `${HOST_URL}${SERVER_CONTEXT}/api/education/download/${file.id}`;
          }

          // 文件预览
          this.preview = (archiveDetail) => {
            let url = $state.href('documentPreview', {
              id: archiveDetail.id,
            });
            window.open(url,'_blank');
          }

          // 查看更多
          this.getMore = () => {
            this.showContent = !this.showContent;
          }

          // 获取教育详情
          this.getDetail = () => {
            $http.get(`${SERVER_CONTEXT}/api/education/queryEducationInfo/${id}`)
                .then((resp) => {               
                  this.disclosureList = resp.data;
                })
          } 

          // 初始化页面
          this.initPage = () => {
            // 获取列表信息
            this.getDetail();
          }

          this.initPage();

        }
      });
    }
  }
}